from api.order import OrderAPI
from common.utils import common_assert


class TestOrderAPI:
    def setup_class(self):
        self.order_api = OrderAPI()

    # 登录成功
    def test_login(self):
        response = self.order_api.login(username="zj010128", password="a123456")
        print(response.json())
        common_assert(response)

    # 登录失败(账号为空)
    def test_login_fail(self):
        response = self.order_api.login(username="", password="a1234567")
        print(response.json())
        common_assert(response, 200, 700, "不存在")

    # 登录失败(账号错误)
    def test_login_fail_username_error(self):
        response = self.order_api.login(username="hym010128", password="a123456")
        print(response.json())
        common_assert(response, 200, 700, "不存在")

    # 登录失败(密码为空)
    def test_login_fail_password_empty(self):
        response = self.order_api.login(username="zj010128", password="")
        print(response.json())
        common_assert(response, 200, 700, "不对")

    # 登录失败(密码错误)
    def test_login_fail_password_error(self):
        response = self.order_api.login(username="zj010128", password="a1234567")
        print(response.json())
        common_assert(response, 200, 700, "不对")
